package com.example.dao.implDao;

import com.example.dao.UserRoleDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class UserRoleDaoImpl implements UserRoleDao {
    private final JdbcTemplate jdbcTemplate;
    @Autowired
    public UserRoleDaoImpl(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }
    @Override
    public int addUserRole(int uid, int rid) {
        String sql = "INSERT INTO t_user_role(`uid`,`rid`) VALUES (?, ?)";
        return jdbcTemplate.update(
                sql,uid,rid
        );
    }
}
